﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplicationBindersSample.Models.BindReadOnlyCollectionModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ReadOnlyCollection&lt;T&gt; Binding
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>ReadOnlyCollection&lt;T&gt; Binding</h2>
    <div>
        <% using (Html.BeginForm()) { %>
            <div>
                <fieldset>
                    <legend>Incoming model</legend>
                    <% int count = (Model != null && Model.Collection != null) ? Model.Collection.Count : 0; %>
                    <p>Count: <%: count %></p>
                    <% for (int i = 0; i < count; i++) { %>
                        <p>Element <%: i %>: <%: Model.Collection[i] %></p>
                    <% } %>
                </fieldset>
            </div>
            <div>
                <fieldset>
                    <legend>New input</legend>
                    <p>Element 0: <%: Html.TextBoxFor(m => m.Collection[0]) %></p>
                    <p>Element 1: <%: Html.TextBoxFor(m => m.Collection[1]) %></p>
                    <p>Element 2: <%: Html.TextBoxFor(m => m.Collection[2]) %></p>
                    <p><input type="submit" /></p>
                </fieldset>
            </div>
        <% } %>
    </div>
</asp:Content>
